The original function is as follows:function GetCookie (key) {var arr1 = Document.cookie.split (';'); for (var i = 0;iWhen using split () for arr1, use '; ' to split the error; Use function to get a undefined; Workaround: You must add a space, use ';
Function setcookie (name, value) {var days = 365; // This cookie will be saved for 30 days var exp = new date (); // new date ("December 31,999 8"); exp. settime (exp. gettime () + days * 24x60*60*1000); document. cookie = Name + "=" + escape (value)
Do BBS and commercial website should often use, there is no reason to let users enter the password every time to log in. We need cookies to implement the automatic login feature:01.function GetCookie (name) {var start = document.cookie.indexOf (name
Document.cookie = ' name= ' + ' username '; Document.cookie= ' value= ' + ' value1 '; varCookarr = Document.cookie.replace (/\s/g, ""). Split (';');//Replace all the spaces in the cookie, or there will be a space to make the result impossible to
Preface
Javascript is an object-based Dynamic Language. That is to say, everything is an object. A typical example is that a function is considered a common object. Javascript can implement object-oriented programming through certain design patterns.
ObjectiveJavaScript is an object-based dynamic language, which means that everything is an object, and a typical example is that functions are also considered ordinary objects. JavaScript can implement object-oriented programming through certain
JavaScript is an object-based dynamic language, which means that everything is an object, and a typical example is that functions are also considered ordinary objects. PrefaceJavaScript is an object-based dynamic language, which means that
This pointer of Javascript is very easy to understand and use the wrong feature. This is especially true for comrades who have been engaged in static languages for a long time.
Example
Let's take a look at the simplest Javascript this pointer
Installed a few versions of Magento, installed after the landing in the background when all encountered a point of problem, the user name and password are entered correctly, is not landing backstage, after research found that landing is not the main
Installed a few versions of Magento, installed after the landing in the background when all encountered a point of problem, the user name and password are entered correctly, is not landing backstage, after research found that landing is not the main
Objective
JavaScript is an object-based dynamic language, that is, everything is an object, and a typical example is that a function is also considered an ordinary object. Javascript can achieve object-oriented programming through certain design
In the process of developing website applications, using cookies to record user information is a common method, and the use of cookies is also very simple.1. Cookie is added to the Set-Cookie response header Through the addCookie method of
Javascript operation cookie method function set problems:
This allows you to use the previous settings when accessing the page or share data between different pages. For example, if you set the page font size when visiting a website, you will want
Method 1: Cookie operations,CodeEncapsulation. The following methods are also available for your reference.
Copy code The Code is as follows: String. Prototype. Trim = function ()
{
Return this. Replace (/^ \ s +/g, ""). Replace (/\ s + $/g ,"");
}
Method 1: cookie operation class, code encapsulated. The following methods are also available for your reference.Copy codeThe Code is as follows:String. prototype. Trim = function (){Return this. replace (/^ \ s +/g, ""). replace (/\ s + $/g
The first method: Cookie operation class, code encapsulation, the following also have the use of methods, we can refer to the following.
Copy Code code as follows:
String.prototype.Trim = function ()
{
Return This.replace (/^\s+/g, ""
How to use cookies in Vue to operate instances and vuecookie to operate instances
Hello everyone, the company is busy with projects, so it has not published any new articles for some time. Today, I want to talk about how to use cookies. Similarly,
Copy Code code as follows:
JS Operation Cookie Method!
Write cookies
function Setcookie (name,value)
{
var days = 30;
var exp = new Date ();
Exp.settime (Exp.gettime () + days*24*60*60*1000);
Document.cookie = name + "=" + Escape (value)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.